<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="webroot" value="${pageContext.request.contextPath}" />
<html lang="en">
<head>
<meta charset="utf-8">
<title>权限设置</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="${webroot}/static/layui/css/layui.css"
	media="all" />
<link rel="stylesheet" href="${webroot}/static/css/public.css"
	media="all" />
<link rel="stylesheet" href="${webroot}/static/css/topdiv.css" media="all" />
<style type="text/css">
.layui-form-checkbox[lay-skin=primary] {
	padding-top: 8px;
}
</style>
</head>
<body class="childrenBody">
	<div class="bread">
		<ul><li> 当前位置&nbsp;:</li><li>角色列表</li>&gt;<li><c:if test="${role.roleId == null}">添加角色</c:if><c:if test="${role.roleId != null}">修改角色</c:if></li></ul>
	</div>
	<br><br>
	<form class="layui-form" style="width: 80%;">
	 	<input type="hidden" id="id" name="id" value="${role.roleId}" />
		<div class="layui-table-body layui-table-main"
			style="overflow: hidden;">
			<table cellspacing="0" cellpadding="0" border="0" class="layui-table">
				<tbody>
					<div class="magb15 layui-col-md4 layui-col-xs12">
						<label class="layui-form-label">角色:</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input roleName"
								lay-verify="required" value="${role.roleName}">
						</div>
					</div>
					<div class="magb15 layui-col-md4 layui-col-xs12">
						<label class="layui-form-label">选择权限:</label>
						<div class="layui-input-block">
							<input type="checkbox" lay-skin="primary" id="owner_all"
								lay-filter="owner_all" title="全选" value="">
						</div>
					</div>
					<div class="magb15 layui-col-md4 layui-col-xs12">
						<label class="layui-form-label">状态:</label>
						<div class="layui-input-block">
							<select name="status" lay-verify="required">
								<c:if test="${role.status == 0}">
									<option selected="selected" value="0">启用</option>
									<option value="1">停用</option>
								</c:if>
								<c:if test="${role.status == 1}">
									<option value="0">启用</option>
									<option selected="selected" value="1">停用</option>
								</c:if>
								<c:if test="${role.status == null}">
									<option value="0">启用</option>
									<option value="1">停用</option>
								</c:if>
							</select>
						</div>
					</div>
					<c:forEach items="${list}" var="l" varStatus="u">
						<tr data-index="0" class="">
							<td data-field="id" data-key="1-0-0" class=""><input
								type="checkbox" id="${l.isShow}" name="q${l.resourceId}"
								lay-skin="primary" class="a${l.resourceId}"
								lay-filter="z${l.resourceId}" title="${l.resourceName}"
								value="${l.resourceId}"> </td>
						</tr>
						<c:forEach items="${l.list}" var="s">
							<tr data-index="0" class="">
								<td data-field="id" data-key="1-0-0" class=""><input
									type="checkbox" id="${s.isShow}" name="w${s.resourceId}"
									lay-skin="primary" class="s${s.resourceId}"
									lay-filter="x${s.resourceId}" title="${s.resourceName}"
									value="${s.resourceId}"> </td>
								<c:forEach items="${s.lists}" var="k">
									<td data-field="id" data-key="1-0-0" class=""><input
										type="checkbox" id="${k.isShow}" name="e${s.resourceId}"
										lay-skin="primary" class="d${s.resourceId}"
										lay-filter="c${s.resourceId}" title="${k.resourceName}"
										value="${k.resourceId}"> </td>
								</c:forEach>
							</tr>
						</c:forEach>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<div class="layui-form-item layui-row layui-col-xs12">
			<div class="layui-input-block" style="text-align: center;">
				<button class="layui-btn" lay-submit="" lay-filter="addRole"
					style="width: 90px;">提交</button>
				<button type="reset" class="layui-btn layui-btn-primary"
					onclick="close_self();">返回</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="${webroot}/static/layui/layui.js"></script>
	<script src="${webroot}/static/js/jquery-3.2.1.min.js" charset="utf-8"></script>
	<script>
		layui.use([ 'form', 'layer' ], function() {
			var form = layui.form
			layer = parent.layer === undefined ? layui.layer : top.layer,
					$ = layui.jquery;
			$("input:checkbox[name='q101']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w102']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e102']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w107']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e107']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='q111']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w112']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e112']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w115']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w116']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w117']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e117']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='q119']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w120']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e120']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w121']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e121']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w122']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='q123']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w124']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w125']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e125']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='q128']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w129']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e129']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w130']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e130']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='q131']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w132']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='e132']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w133']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w134']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w135']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w136']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w137']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w138']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w139']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w161']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w162']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			$("input:checkbox[name='w163']").each(function(i) {
				var id = $(this).attr("id");
				if (id != '') {
					$(this).prop("checked", true);
					form.render('checkbox');
				}
			});
			form.on("submit(addRole)", function(data) {
				var id = new Array();
				var name = new Array();
				$("input:checkbox[name='q101']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w102']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e102']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w107']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e107']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='q111']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w112']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e112']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w115']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w116']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w117']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e117']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='q119']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w120']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e120']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w121']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e121']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w122']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='q123']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w124']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w125']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e125']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='q128']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w129']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e129']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w130']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e130']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='q131']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w132']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='e132']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w133']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w134']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w135']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w136']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w137']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w138']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w139']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w161']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w162']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				$("input:checkbox[name='w163']:checked").each(function(i) {
					id.push($(this).val());
					name.push($(this).attr("title"));
				});
				var index = top.layer.msg('数据提交中，请稍候', {
					icon : 16,
					time : false,
					shade : 0.8
				});
				var url = "";
				if ($("#id").val() != "null" && $("#id").val() != "") {
					url = '${webroot}/sysrole/update';
				} else {
					url = '${webroot}/sysrole/insert';
				}
				// 实际使用时的提交信息
				$.post(url, {
					roleId : $("#id").val(),
					resourceId : id.join(","),
					resourceName : name.join(","),
					status : data.field.status,
					roleName : $(".roleName").val()
				}, function(res) {
					var data = JSON.parse(res);
					if (data.success) {
						top.layer.close(index);
						top.layer.msg("操作成功,相关用户退出后重新登录生效!");
					} else {
						top.layer.msg(data.message);
					}
				})
				return false;
			})

			form.on('checkbox(owner_all)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a101").prop("checked", true);
					$(".a111").prop("checked", true);
					$(".a119").prop("checked", true);
					$(".a123").prop("checked", true);
					$(".a128").prop("checked", true);
					$(".a131").prop("checked", true);
					$(".s102").prop("checked", true);
					$(".s107").prop("checked", true);
					$(".d102").prop("checked", true);
					$(".d107").prop("checked", true);
					$(".s112").prop("checked", true);
					$(".s115").prop("checked", true);
					$(".s116").prop("checked", true);
					$(".s117").prop("checked", true);
					$(".d112").prop("checked", true);
					$(".d117").prop("checked", true);
					$(".s120").prop("checked", true);
					$(".s121").prop("checked", true);
					$(".s122").prop("checked", true);
					$(".d120").prop("checked", true);
					$(".d121").prop("checked", true);
					$(".s124").prop("checked", true);
					$(".s125").prop("checked", true);
					$(".d125").prop("checked", true);
					$(".s129").prop("checked", true);
					$(".s130").prop("checked", true);
					$(".d129").prop("checked", true);
					$(".d130").prop("checked", true);
					$(".s132").prop("checked", true);
					$(".s133").prop("checked", true);
					$(".s134").prop("checked", true);
					$(".s135").prop("checked", true);
					$(".s136").prop("checked", true);
					$(".s137").prop("checked", true);
					$(".s138").prop("checked", true);
					$(".s139").prop("checked", true);
					$(".d132").prop("checked", true);
					$(".s161").prop("checked", true);
					$(".s162").prop("checked", true);
					$(".s163").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".a101").prop("checked", false);
					$(".a111").prop("checked", false);
					$(".a119").prop("checked", false);
					$(".a123").prop("checked", false);
					$(".a128").prop("checked", false);
					$(".a131").prop("checked", false);
					$(".s102").prop("checked", false);
					$(".s107").prop("checked", false);
					$(".d102").prop("checked", false);
					$(".d107").prop("checked", false);
					$(".s112").prop("checked", false);
					$(".s115").prop("checked", false);
					$(".s116").prop("checked", false);
					$(".s117").prop("checked", false);
					$(".d112").prop("checked", false);
					$(".d117").prop("checked", false);
					$(".s120").prop("checked", false);
					$(".s121").prop("checked", false);
					$(".s122").prop("checked", false);
					$(".d120").prop("checked", false);
					$(".d121").prop("checked", false);
					$(".s124").prop("checked", false);
					$(".s125").prop("checked", false);
					$(".d125").prop("checked", false);
					$(".s129").prop("checked", false);
					$(".s130").prop("checked", false);
					$(".d129").prop("checked", false);
					$(".d130").prop("checked", false);
					$(".s132").prop("checked", false);
					$(".s133").prop("checked", false);
					$(".s134").prop("checked", false);
					$(".s135").prop("checked", false);
					$(".s136").prop("checked", false);
					$(".s137").prop("checked", false);
					$(".s138").prop("checked", false);
					$(".s139").prop("checked", false);
					$(".d132").prop("checked", false);
					$(".s161").prop("checked", false);
					$(".s162").prop("checked", false);
					$(".s163").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x102)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".d102").prop("checked", true);
					$(".a101").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w102']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w107']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a101").prop("checked", false);
					}
					$(".d102").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x107)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".d107").prop("checked", true);
					$(".a101").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w102']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w107']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a101").prop("checked", false);
					}
					$(".d107").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c102)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s102").prop("checked", true);
					$(".a101").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c107)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s107").prop("checked", true);
					$(".a101").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(z101)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s102").prop("checked", true);
					$(".s107").prop("checked", true);
					$(".d102").prop("checked", true);
					$(".d107").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s102").prop("checked", false);
					$(".s107").prop("checked", false);
					$(".d102").prop("checked", false);
					$(".d107").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x112)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					$(".d112").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w112']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w115']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w116']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w117']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a111").prop("checked", false);
					}
					$(".d112").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c112)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					$(".s112").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c120)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a119").prop("checked", true);
					$(".s120").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c121)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a119").prop("checked", true);
					$(".s121").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c129)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a128").prop("checked", true);
					$(".s129").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c130)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a128").prop("checked", true);
					$(".s130").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c125)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a123").prop("checked", true);
					$(".s125").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c132)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					$(".s132").prop("checked", true);
					form.render('checkbox');
				}
			});

			form.on('checkbox(c117)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					$(".s117").prop("checked", true);
					form.render('checkbox');
				}
			});
			form.on('checkbox(x115)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w112']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w115']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w116']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w117']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a111").prop("checked", false);
					}
					form.render('checkbox');
				}
			});
			form.on('checkbox(x116)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w112']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w115']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w116']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w117']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a111").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x117)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a111").prop("checked", true);
					$(".d117").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w112']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w115']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w116']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w117']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a111").prop("checked", false);
					}
					$(".d117").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(z111)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s112").prop("checked", true);
					$(".s115").prop("checked", true);
					$(".s116").prop("checked", true);
					$(".s117").prop("checked", true);
					$(".d112").prop("checked", true);
					$(".d117").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s112").prop("checked", false);
					$(".s115").prop("checked", false);
					$(".s116").prop("checked", false);
					$(".s117").prop("checked", false);
					$(".d112").prop("checked", false);
					$(".d117").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x120)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a119").prop("checked", true);
					$(".d120").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w120']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w121']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w122']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a119").prop("checked", false);
					}
					$(".d120").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x121)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a119").prop("checked", true);
					$(".d121").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w120']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w121']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w122']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a119").prop("checked", false);
					}
					$(".d121").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x122)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a119").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w120']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w121']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w122']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a119").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(z119)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s120").prop("checked", true);
					$(".s121").prop("checked", true);
					$(".s122").prop("checked", true);
					$(".d120").prop("checked", true);
					$(".d121").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s120").prop("checked", false);
					$(".s121").prop("checked", false);
					$(".s122").prop("checked", false);
					$(".d120").prop("checked", false);
					$(".d121").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x124)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a123").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w124']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w125']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a123").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x125)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a123").prop("checked", true);
					$(".d125").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w124']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w125']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a123").prop("checked", false);
					}
					$(".d125").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(z123)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s124").prop("checked", true);
					$(".s125").prop("checked", true);
					$(".d125").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s124").prop("checked", false);
					$(".s125").prop("checked", false);
					$(".d125").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x129)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a128").prop("checked", true);
					$(".d129").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w129']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w130']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a128").prop("checked", false);
					}
					$(".d129").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x130)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a128").prop("checked", true);
					$(".d130").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w129']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w130']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a128").prop("checked", false);
					}
					$(".d130").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(z128)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s129").prop("checked", true);
					$(".s130").prop("checked", true);
					$(".d129").prop("checked", true);
					$(".d130").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s129").prop("checked", false);
					$(".s130").prop("checked", false);
					$(".d129").prop("checked", false);
					$(".d130").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x132)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					$(".d132").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					$(".d132").prop("checked", false);
					form.render('checkbox');
				}
			});

			form.on('checkbox(x133)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x134)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x135)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x136)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x137)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x138)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(x139)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".a131").prop("checked", true);
					form.render('checkbox');
				} else {
					var arr1 = new Array();
					$("input:checkbox[name='w132']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w133']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w134']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w135']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w136']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w137']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w138']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					$("input:checkbox[name='w139']:checked").each(function(i) {
						arr1[i] = $(this).val();
					});
					if (arr1.length < 1) {
						$(".a131").prop("checked", false);
					}
					form.render('checkbox');
				}
			});

			form.on('checkbox(z131)', function(data) {
				var a = data.elem.checked;
				if (a == true) {
					$(".s132").prop("checked", true);
					$(".s133").prop("checked", true);
					$(".s134").prop("checked", true);
					$(".s135").prop("checked", true);
					$(".s136").prop("checked", true);
					$(".s137").prop("checked", true);
					$(".s138").prop("checked", true);
					$(".s139").prop("checked", true);
					$(".d132").prop("checked", true);
					form.render('checkbox');
				} else {
					$(".s132").prop("checked", false);
					$(".s134").prop("checked", false);
					$(".s135").prop("checked", false);
					$(".s136").prop("checked", false);
					$(".s137").prop("checked", false);
					$(".s138").prop("checked", false);
					$(".s139").prop("checked", false);
					$(".s133").prop("checked", false);
					$(".d132").prop("checked", false);
					form.render('checkbox');
				}
			});

			//格式化时间
			function filterTime(val) {
				if (val < 10) {
					return "0" + val;
				} else {
					return val;
				}
			}
			//定时发布
			var time = new Date();
			var submitTime = time.getFullYear() + '-'
					+ filterTime(time.getMonth() + 1) + '-'
					+ filterTime(time.getDate()) + ' '
					+ filterTime(time.getHours()) + ':'
					+ filterTime(time.getMinutes()) + ':'
					+ filterTime(time.getSeconds());

		})
		function close_self() {
			window.location.href = '${webroot}/sysrole/showlist?id=${resourceId}';
		}
	</script>
</body>
</html>